<!DOCTYPE html>
<html>
<head>
<!-- 头部 -->
@layout("/common/header.html"){
@}
</head>

<body>
<div id="wrapper">
<!-- 左侧菜单-->
@layout("/common/sidebar.html"){
@}

<div id="page-wrapper" class="gray-bg dashbard-1">
<div class="row border-bottom">
<!--顶部导航  -->
@layout("/common/navbar.html"){
@}
</div>
 
     <div class="row wrapper border-bottom white-bg page-heading">
	      <div class="col-lg-10">
	          <h2>用户列表</h2>
	          <ol class="breadcrumb">
	              <li>
	                  <a href="">主页</a>
	              </li>
	              <li>
	                  <a>系统管理</a>
	              </li>
	              <li>
	                  <strong>用户列表</strong>
	              </li>
	          </ol>
	      </div>
    </div>

	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-lg-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-inline" id="queryForm">
						<div class="row">
							
								<div class="col-sm-3">
									<div class="input-group">
										<input type="text" id="keyword" placeholder="请输入标签名称"
											class="input-sm form-control"> <span
											class="input-group-btn">
											<button type="button" class="btn btn-sm btn-primary search" >搜索</button> 
										</span>
									</div>
									<button type="button" class="btn btn-sm btn-danger add" >新增标签</button>
								</div>
								
							
						</div>

						<!-- 表格数据 -->
								<div id="dataList">
									<div></div>
									<table
										class="table table-striped table-bordered table-hover dataTables-example">
										<thead>
											<tr>
												<th>登录名</th>
												<th>显示名称</th>
												<th>公司名称</th>
												<th>组织名称</th>
												<th>手机号码</th>
												<th>联系电话</th>
												<th>用户类型</th>
												<th>状态</th>
												<th>操作</th>
											</tr>
										</thead>
										<tbody>
										
											@for(item in page.list){
												<tr class="gradeX">
													<td>${ item.loginName!}</td>
													<td>${ item.showName!}</td>
													<td>${ item.companyId!}</td>
													<td>${ item.orgName!}</td>
													<td>${ item.mp!}</td>
													<td>${ item.telephone!}</td>
													<td>${ item.userType!}</td>
													<td>${ item.status!}</td>
													<td>
														<button class="btn btn-primary btn-xs edit" type="button" title="编辑" code="${ item.id!}">编辑</button>
														<button class="btn btn-danger btn-xs delete" type="button" title="删除" code="${ item.id!}">删除</button>
													</td>
												</tr>
											@}

										</tbody>
									</table>

									@include("/common/_pagination.html",{page:page}){}

								</div>
								</form>
							</div>
				</div>
			</div>
		</div>
	</div>
	
	
	
    
    
    <!-- 新增页面 -->
	<div class="modal inmodal fade" id="addUserModal" tabindex="-1" role="dialog"  aria-hidden="true">
	      <div class="modal-dialog modal-lg">
	          <div class="modal-content">
	              <div class="modal-header">
	                  <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
	                  <small class="font-bold">用户信息</small>
	              </div>
	              <div class="modal-body col-sm-12" id="addUserContent">
                       
	                  
	              </div>
	
	              <div class="modal-footer">
	                  <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
	                  <button type="button" class="btn btn-primary save">保存</button>
	              </div>
	          </div>
	      </div>
	  </div>
                            
     <!-- 编辑页面 -->
    <div class="modal inmodal fade" id="editUserModal" tabindex="-1" role="dialog"  aria-hidden="true">
	      <div class="modal-dialog modal-lg">
	          <div class="modal-content">
	              <div class="modal-header">
	                  <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
	                  <small class="font-bold">用户信息</small>
	              </div>
	              <div class="modal-body col-sm-12" id="editUserContent">
                       
	                  
	              </div>
	
	              <div class="modal-footer">
	                  <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
	                  <button type="button" class="btn btn-primary save">保存</button>
	              </div>
	          </div>
	      </div>
	  </div>          
                            
	<!-- 底部 -->
@layout("/common/footer.html"){
@}	

<!-- jQuery Validation plugin javascript-->
<script src="${ctxPath}/static/js/plugins/validate/jquery.validate.min.js"></script>
<script src="${ctxPath}/static/js/plugins/validate/messages_zh.min.js"></script>
<script src="${ctxPath}/static/js/plugins/validate/messages_zh.min.js"></script>
<script type="text/javascript">
//点击添加按钮
$(".add").click(function(){
	$.ajax({
        url : '${ctxPath}/system/user/addJump',
        success  : function(data) {
        	$('#addUserContent').html(data);
        	$('#addUserModal').modal('show');
		}
    });
	
});

//编辑
$(".edit").click(function(){
	$.ajax({
        url : '${ctxPath}/system/user/editJump/'+$(this).attr("code"),
        success  : function(data) {
        	$('#editUserContent').html(data);
        	$('#editUserModal').modal('show');
		}
    });
});

//删除
$(".delete").click(function(){
	var id = $(this).attr("code");

	//询问框
	parent.layer.confirm('您确定要删除吗？', {
	    btn: ['确定','取消'] //按钮
	}, function(){
		
		
		$.ajax({
	        url : '${ctxPath}/system/user/delete',
	        data : {"id":id},
	        success  : function(data) {
	        	console.info(data);
	        	if(data.status == 200){
	        		$('#addUserModal').modal('hide');
	        		layer.alert("删除成功");
	        		location.reload();
	        	}else{
	        		layer.alert("删除失败");
	        	}
			}
	    });
	}, function(){
	    layer.msg('已经取消', {shift: 6});
	});
});
</script>
